EZWindows with Microsoft Visual C++
Creating an EZWindows project with Microsoft Visual C++
This
will be a step by step walk through of the process of creating a simple program
with Microsoft Visual C++ and the EZWindows Graphical library.
Introduction
In this tutorial we will walk through the process of
setting up a VC++ Workspace to use the EZWindows library. This is accomplished
by adding the library to the project and telling the project where to look for
header files and library files.
The first four steps is the same as creating
a console application. The program we enter will, of course, use ApiMain()
instead of a main() function. We'll use this code for our sample:
#include "ezwin.h"
#include "square.h"
SimpleWindow
MyWindow("EZWin Tutorial");
int ApiMain() {
SquareShape MySquare(MyWindow, Position(2, 2));
MyWindow.Open();
MySquare.Draw();
return 0;
}
A simple program to draw a square in the default color on a window.
After the code has been entered, we must tell the project to use the Visual
C++ version of the EZWindows library and set the path to the header files and
library file. Select Project->Settings from the menu. A dialog box should
appear:
- Select the "C/C++" tab.
- On the "Category" pulldown menu, select "Preprocessor." Enter the path for
the EZWindows header files in the text box labeled "Additional include
directories". For the labs, this will be I:\ezwin\include.
- Select the "Link" tab.
- Under the "Category" pulldown menu, select "Input". At the beginning of
the list of "Object/module libraries", enter the name of the EZWindows VC++
library. For the labs, enter "ezwinvc50.lib ". In the text box labeled
"Additional library path" enter the path to the EZWindows library. This is
I:\ezwin\lib in the labs.
- Press OK.
You may now compile, link, and run the program like any other VC++ program.
If you forget to set the include directory, you will receive a message
similar to this
one:
k:\ms\visualstudio\myprojects\ezwintut\ezwintut.cpp(1) : fatal error
C1083: Cannot open include file: 'ezwin.h': No such file or directory
Not putting the library file into the project will result in a message like:
ezwintut.obj : error LNK2001: unresolved external symbol "public:
__thiscall SimpleWindow::SimpleWindow(char const *,float,float,class Position
const &)" (??0SimpleWindow@@QAE@PBDMMABVPosition@@@Z)